package com.softjourn.punchcard.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonAutoDetect
@JsonIgnoreProperties(ignoreUnknown = true)
public class PunchCard implements Parcelable {
	
	private String uid;

	private Integer bonuses;
	
	private Merchant merchant;
	
	private Client client;
	
	public PunchCard() {
		
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public Integer getBonuses() {
		return bonuses;
	}

	public void setBonuses(Integer bonuses) {
		this.bonuses = bonuses;
	}

	public Merchant getMerchant() {
		return merchant;
	}

	public void setMerchant(Merchant merchant) {
		this.merchant = merchant;
	}

	public Client getClient() {
		return client;
	}

	public void setClient(Client client) {
		this.client = client;
	}

	@Override
	public String toString() {
		return "PunchCard [uid=" + uid + ", bonuses=" + bonuses + ", merchant="
				+ merchant + ", client=" + client + "]";
	}

	public PunchCard(Parcel in) {
		readFromParcel(in);
	}
	
	@Override
	public int describeContents() {
		return 0;
	}
	
	@Override
	public void writeToParcel(Parcel parcel, int flags) {
		parcel.writeInt(bonuses);
		parcel.writeString(uid);
	}
	
	private void readFromParcel(Parcel in) {
		bonuses = in.readInt();
		uid = in.readString();
	}
	
	public static final Parcelable.Creator<PunchCard> CREATOR =
			new Parcelable.Creator<PunchCard>() {
				public PunchCard createFromParcel(Parcel in) {
					return new PunchCard(in);
				}
				
				public PunchCard[] newArray(int size) {
					return new PunchCard[size];
				}
			};

}
